﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>Admin.Net-主页</title>
    <link rel="stylesheet" href="/component/pear/css/pear.css" />
    <link rel="stylesheet" href="/admin/css/admin.css" />
    <link rel="stylesheet" href="/admin/css/admin.dark.css" />
    <link rel="stylesheet" href="/admin/css/variables.css" />
    <link rel="stylesheet" href="/admin/css/reset.css" />
</head>
<body class="layui-layout-body pear-admin">
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header">
            <div class="layui-logo">
                <img class="logo">
                <span class="title"></span>
            </div>
            <ul class="layui-nav layui-layout-left">
                <li class="collapse layui-nav-item"><a href="#" class="layui-icon layui-icon-shrink-right"></a></li>
                <li class="refresh layui-nav-item"><a href="#" class="layui-icon layui-icon-refresh-1" loading=600></a></li>
            </ul>
            <div id="control" class="layui-layout-control"></div>
            <ul class="layui-nav layui-layout-right">
                <li class="layui-nav-item layui-hide-xs"><a href="#" class="menuSearch layui-icon layui-icon-search"></a></li>
                <li class="layui-nav-item layui-hide-xs message"></li>
                <li class="layui-nav-item layui-hide-xs"><a href="#" class="fullScreen layui-icon layui-icon-screen-full"></a></li>
                <li class="layui-nav-item user">
                    <a class="layui-icon layui-icon-username" href="javascript:;"></a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:void(0);changePage({id:5555,title:'基本资料',url:'/admin/user/profile'})" user-menu-title="基本资料">基本资料</a></dd>
                        <dd><a href="javascript:void(0);" class="logout">注销登录</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item setting"><a href="#" class="layui-icon layui-icon-more-vertical"></a></li>
            </ul>
        </div>
        <div class="layui-side layui-bg-black">
            <div class="layui-logo">
                <img class="logo">
                <span class="title"></span>
            </div>
            <div class="layui-side-scroll">
                <div id="side"></div>
            </div>
        </div>
        <div class="layui-body">
            <div id="content"></div>
        </div>
        <div class="layui-footer layui-text"></div>
        <div class="pear-cover"></div>
        <div class="loader-wrapper">
            <div class="loader"></div>
        </div>
    </div>
    <div class="pear-collapsed-pe collapse">
        <a href="#" class="layui-icon layui-icon-shrink-right"></a>
    </div>
    <script src="/component/layui/layui.js"></script>
    <script src="/component/pear/pear.js"></script>
    <script>
        layui.use(['admin', 'popup', 'tabPage', 'http'], function () {
            var $ = layui.$;
            var admin = layui.admin;
            var popup = layui.popup;
            var tabPage = layui.tabPage;
            var http = layui.http;

            // yml | json | api
            admin.setConfigurationPath("/api/config/config");

            // 渲染
            admin.render();

            //获取用户信息
            http.get('/api/sysAuth/userInfo').then((res) => {
                console.log(res)
            })

            // 注销
            admin.logout(function () {
                layer.confirm('您确定要退出登录吗？', function () {
                    http.post('/api/sysAuth/logout').then((res) => {
                        popup.success("注销成功", function () {
                            location.href = "/";
                        })
                        // 清空 tabs 缓存
                        return new Promise((resolve) => {
                            resolve(true)
                        });
                    })
                });

            });

            //打开tabPage
            window.changePage = function (option) {
                option.type = '_iframe';
                admin.changePage(option)
            }
        })
    </script>
</body>
</html>